/**
 * Created by charlie on 18-1-11.
 */
export default {
    namespace:'pangitor',
    state:{
        jumpPage:'', //跳转页
    },
    subscriptions:{

    },
    effects: {
        //上一页
        *tableLastPage({payload}, {call, put, select}){
            yield put({type: payload.namespace + '/' + payload.mainFunction, payload:{page:payload.currentPage - 1}})
        },
        //下一頁
        *tableNextPage({payload}, {call, put, select}){
            yield put({type: payload.namespace + '/' + payload.mainFunction, payload:{page:payload.currentPage + 1}})
        },
        //确定跳转
        *sureJump({payload}, {call, put, select}){
            yield put({type: payload.namespace + '/' + payload.mainFunction, payload:{page:payload.jumpPage}});
            yield put({type:'init'})
        },
        *change({payload}, {put, select, call}){
            yield put({type: 'changePage', payload: payload})
        },
    },
    reducers:{
        //输入jumpPage
        changePage(state,{payload}){
            return {...state,...payload}
        },
        //初始化jumpPage（跳转页）
        init(state,{payload}){
            return {...state,jumpPage:''}
        }
    }
}